package com.saleoffline.server.domain.sale;

import java.util.HashMap;
import java.util.Map;

import com.saleoffline.server.Search;

public class SaleSearch extends Search {
	private OrderByType orderByType;
	
	public static Map<OrderByType, OrderByItem> orderByMapping = new HashMap<OrderByType, OrderByItem>() {{
		put(OrderByType.DATE, new OrderByItem("id", SortType.DESC));
//		put(OrderByType.LOCATION, new OrderByItem("location_id", SortType.ASC));
		put(OrderByType.SALEOFF, new OrderByItem("sale_off_to", SortType.DESC));
		put(OrderByType.ID, new OrderByItem("id", SortType.DESC));
//		put(OrderByType.HOT, "");
	}};
	
	public SaleSearch() {
		addOrderByItem(orderByMapping.get(OrderByType.ID));
	}
	
	public static enum OrderByType {
		ID, DATE, LOCATION, SALEOFF, HOT
	}

	public OrderByType getOrderByType() {
		return orderByType;
	}

	public void setOrderByType(OrderByType orderByType) {
		this.orderByType = orderByType;
		addOrderByItem(orderByMapping.get(orderByType));
	}
}